//获取ng-app
angular.module("myApp")
.controller("CommunityController", ["$scope","CommunityService","CommunityGetService",function($scope,CommunityService,CommunityGetService){
	//定义一个变量接受点击左边的时候对应的index值，传到右边让其显示。
	//=====================点击发生样式的变化==
	//定义一个变量接受对应的下标index
	$scope.dex = 0;
	//定义接受一个点击后存储下来的对象
	$scope.accepts="";
	console.log($scope.accepts);
	$scope.fn=function(a,e){
		$scope.dex = a;	
		//如果不为空  上一次点击的对象恢复原样式
		if ($scope.accepts!=null) {
			$scope.accepts.className = "community_get_left_list1";
		};
		//得到对应的点击对象，设置点击后的样式
		e.target.setAttribute("class","community_get_left_list1_click");
		//保留上一次点击的对象
		$scope.accepts=e.target;
	}

	// ==============community_recommend推荐板块1===============
	CommunityService.getData().success(function(res){
		$scope.items = res.data;


	})

	// ===============community_get进入版面2===========
	CommunityGetService.getData().success(function(res1){
		$scope.datas = res1.data;

	})
	//=====================点击发生页面跳转============
	$scope.fm = function(){
		location.href="views/community/community/community_recommend/community_recommend_mate.html"
	}
}])